1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.ViewSwitcherBar; 26 27 private import adw.ViewStack; 28 private import adw.c.functions; 29 public import adw.c.types; 30 private import glib.ConstructionException; 31 private import gobject.ObjectG; 32 private import gtk.AccessibleIF; 33 private import gtk.AccessibleT; 34 private import gtk.BuildableIF; 35 private import gtk.BuildableT; 36 private import gtk.ConstraintTargetIF; 37 private import gtk.ConstraintTargetT; 38 private import gtk.Widget; 39 40 41 /** 42 * A view switcher action bar. 43 * 44 * <picture> 45 * <source srcset="view-switcher-bar-dark.png" media="(prefers-color-scheme: dark)"> 46 * <img src="view-switcher-bar.png" alt="view-switcher-bar"> 47 * </picture> 48 * 49 * An action bar letting you switch between multiple views contained in a 50 * [class@ViewStack], via an [class@ViewSwitcher]. It is designed to be put at 51 * the bottom of a window and to be revealed only on really narrow windows, e.g. 52 * on mobile phones. It can't be revealed if there are less than two pages. 53 * 54 * `AdwViewSwitcherBar` is intended to be used together with 55 * [class@ViewSwitcherTitle]. 56 * 57 * A common use case is to bind the [property@ViewSwitcherBar:reveal] property 58 * to [property@ViewSwitcherTitle:title-visible] to automatically reveal the 59 * view switcher bar when the title label is displayed in place of the view 60 * switcher, as follows: 61 * 62 * ```xml 63 * <object class="GtkWindow"> 64 * <child type="titlebar"> 65 * <object class="AdwHeaderBar"> 66 * <property name="centering-policy">strict</property> 67 * <child type="title"> 68 * <object class="AdwViewSwitcherTitle" id="title"> 69 * <property name="stack">stack</property> 70 * </object> 71 * </child> 72 * </object> 73 * </child> 74 * <child> 75 * <object class="GtkBox"> 76 * <property name="orientation">vertical</property> 77 * <child> 78 * <object class="AdwViewStack" id="stack"/> 79 * </child> 80 * <child> 81 * <object class="AdwViewSwitcherBar"> 82 * <property name="stack">stack</property> 83 * <binding name="reveal"> 84 * <lookup name="title-visible">title</lookup> 85 * </binding> 86 * </object> 87 * </child> 88 * </object> 89 * </child> 90 * </object> 91 * ``` 92 * 93 * ## CSS nodes 94 * 95 * `AdwViewSwitcherBar` has a single CSS node with name` viewswitcherbar`. 96 * 97 * Since: 1.0 98 */ 99 public class ViewSwitcherBar : Widget 100 { 101 /** the main Gtk struct */ 102 protected AdwViewSwitcherBar* adwViewSwitcherBar; 103 104 /** Get the main Gtk struct */ 105 public AdwViewSwitcherBar* getViewSwitcherBarStruct(bool transferOwnership = false) 106 { 107 if (transferOwnership) 108 ownedRef = false; 109 return adwViewSwitcherBar; 110 } 111 112 /** the main Gtk struct as a void* */ 113 protected override void* getStruct() 114 { 115 return cast(void*)adwViewSwitcherBar; 116 } 117 118 /** 119 * Sets our main struct and passes it to the parent class. 120 */ 121 public this (AdwViewSwitcherBar* adwViewSwitcherBar, bool ownedRef = false) 122 { 123 this.adwViewSwitcherBar = adwViewSwitcherBar; 124 super(cast(GtkWidget*)adwViewSwitcherBar, ownedRef); 125 } 126 127 128 /** */ 129 public static GType getType() 130 { 131 return adw_view_switcher_bar_get_type(); 132 } 133 134 /** 135 * Creates a new `AdwViewSwitcherBar`. 136 * 137 * Returns: the newly created `AdwViewSwitcherBar` 138 * 139 * Since: 1.0 140 * 141 * Throws: ConstructionException GTK+ fails to create the object. 142 */ 143 public this() 144 { 145 auto __p = adw_view_switcher_bar_new(); 146 147 if(__p is null) 148 { 149 throw new ConstructionException("null returned by new"); 150 } 151 152 this(cast(AdwViewSwitcherBar*) __p); 153 } 154 155 /** 156 * Gets whether @self should be revealed or hidden. 157 * 158 * Returns: whether @self is revealed 159 * 160 * Since: 1.0 161 */ 162 public bool getReveal() 163 { 164 return adw_view_switcher_bar_get_reveal(adwViewSwitcherBar) != 0; 165 } 166 167 /** 168 * Gets the stack controlled by @self. 169 * 170 * Returns: the stack 171 * 172 * Since: 1.0 173 */ 174 public ViewStack getStack() 175 { 176 auto __p = adw_view_switcher_bar_get_stack(adwViewSwitcherBar); 177 178 if(__p is null) 179 { 180 return null; 181 } 182 183 return ObjectG.getDObject!(ViewStack)(cast(AdwViewStack*) __p); 184 } 185 186 /** 187 * Sets whether @self should be revealed or hidden. 188 * 189 * Params: 190 * reveal = whether to reveal @self 191 * 192 * Since: 1.0 193 */ 194 public void setReveal(bool reveal) 195 { 196 adw_view_switcher_bar_set_reveal(adwViewSwitcherBar, reveal); 197 } 198 199 /** 200 * Sets the stack controlled by @self. 201 * 202 * Params: 203 * stack = a stack 204 * 205 * Since: 1.0 206 */ 207 public void setStack(ViewStack stack) 208 { 209 adw_view_switcher_bar_set_stack(adwViewSwitcherBar, (stack is null) ? null : stack.getViewStackStruct()); 210 } 211 }